package com.project.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.bean.ThemeBean;
import com.project.mapper.IThemeMapper;
import com.project.service.IThemeService;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;

@Service
@Transactional
public class ThemeServiceImpl implements IThemeService {
    @Autowired
    private IThemeMapper mapper;

    @Override
    public IPage<ThemeBean> cutByItem(Integer pageNO, Integer channelId, String title, String name, LocalDate startDate, LocalDate endDate) {
        return mapper.cutByItem(new Page(pageNO, 3), channelId, title, name, startDate, endDate);
    }

    @Override
    public void add(ThemeBean theme) {
        mapper.insert(theme);
    }

    @Override
    public ThemeBean findById(Integer id) {
        return mapper.findById(id);
    }
}
